import json
import requests
import sys

def func(data):
    if data["data"]["idTwoZ"]["message"]=="一致":
        return True
    else:
        return False




if __name__ == '__main__':
    # step1
    jsonStr = sys.argv[1]
    # # 编写python 调用 java 数据网关的接口返回 数据
    std = json.loads(jsonStr)
    std
    # result dict result的类型
    # 把字典转成字符串
    result={"apiName":"身份证二要素验证","secret":"e7a87080efba4134ad63efd158aa32e0","shortName":"br"}
    result["name"]=std["name"]
    result["id"]=std["id"]
    str = json.dumps(result)
    # 调用数据网关接口 得到结果
    host = 'http://zebra.sit.com'
    server_name = '/service-interface-gateway'
    method = '/api/invoke'
    url = host + server_name + method
    header_dict = {"Content-Type": "application/json; charset=utf8"}
    r = requests.post(url, data=str, headers=header_dict)
    json_data = ''
    if (r.ok):
        json_data = r.json()
    print(func(json_data))